Skip to content

Sourcery refactored main branch #1

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

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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Sep 5, 2023

Branch main 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 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 X-oss-byte September 5, 2023 10:06
@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines -107 to +108
elif a[key] == b[key]:
pass # same leaf value
else:
raise Exception('Conflict at %s' % '.'.join(path + [str(key)]))
elif a[key] != b[key]:
raise Exception(f"Conflict at {'.'.join(path + [str(key)])}")
Copy link
Author

Choose a reason for hiding this comment

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

Function merge refactored with the following changes:

This removes the following comments ( why? ):

# same leaf value

Comment on lines -130 to +131
print("WARNING: cannot find or use %s executable" % DECRYPT_TOOL, file=sys.stderr)
print(
f"WARNING: cannot find or use {DECRYPT_TOOL} executable",
file=sys.stderr,
)
Copy link
Author

Choose a reason for hiding this comment

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

Function check_decrypt_tool refactored with the following changes:

Comment on lines -142 to +145
else:
print("WARNING: NODE_BUILD_SECRETS defined but not a directory", file=sys.stderr)
print("It must be the path to a local checkout of https://github.com/nodejs-private/secrets", file=sys.stderr)
return None
print("WARNING: NODE_BUILD_SECRETS defined but not a directory", file=sys.stderr)
print("It must be the path to a local checkout of https://github.com/nodejs-private/secrets", file=sys.stderr)
return 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 get_secrets_path refactored with the following changes:

print("WARNING: cannot load %s" % file_name, file=sys.stderr)
print(f"WARNING: cannot load {file_name}", file=sys.stderr)
Copy link
Author

Choose a reason for hiding this comment

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

Function load_yaml_secrets refactored with the following changes:

Comment on lines -213 to +214
export[host_type] = {}
export[host_type]['hosts'] = []

key = '~/.ssh/nodejs_build_%s' % host_type
export[host_type] = {'hosts': []}
key = f'~/.ssh/nodejs_build_{host_type}'
Copy link
Author

Choose a reason for hiding this comment

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

Function parse_yaml refactored with the following changes:

Comment on lines -281 to +288
hostinfo = dict()
info = host.split('-')

expected = ['type', 'provider', 'os', 'arch', 'uid']

if len(info) != 5:
raise Exception('Host format is invalid: %s,' % host)

for key, item in enumerate(expected):
hostinfo[item] = has_metadata(info[key])
raise Exception(f'Host format is invalid: {host},')

hostinfo = {item: has_metadata(info[key]) for key, item in enumerate(expected)}
for item in ['type', 'provider', 'arch']:
if hostinfo[item] not in valid[item]:
raise Exception('Invalid %s: %s' % (item, hostinfo[item]))
raise Exception(f'Invalid {item}: {hostinfo[item]}')
Copy link
Author

Choose a reason for hiding this comment

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

Function parse_host refactored with the following changes:

filename = os.path.join(target_dir, '%s.remmina' % hostname)
filename = os.path.join(target_dir, f'{hostname}.remmina')
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

Comment on lines -106 to +107
rendered = '{}{}{}'.format(
pre_match,
render_template(module.params['hostinfo']),
post_match
rendered = (
f"{pre_match}{render_template(module.params['hostinfo'])}{post_match}"
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

Comment on lines -8 to +9
reader = geoip2.database.Reader(os.path.dirname(os.path.realpath(__file__)) + '/GeoLite2-City.mmdb')
reader = geoip2.database.Reader(
f'{os.path.dirname(os.path.realpath(__file__))}/GeoLite2-City.mmdb')
Copy link
Author

Choose a reason for hiding this comment

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

Lines 8-26 refactored with the following changes:

@changeset-bot
Copy link

changeset-bot bot commented Sep 5, 2023

⚠️ No Changeset found

Latest commit: 3ba1916

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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