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

Sourcery refactored master branch #145

Merged
merged 1 commit into from
Oct 13, 2021
Merged

Sourcery refactored master branch #145

merged 1 commit into from
Oct 13, 2021

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Jun 4, 2020

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^

Views.py Show resolved Hide resolved
input_dict = dict()
input_dict = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function case_to_dict refactored with the following changes:

  • Replace dict() with {}

if not username or not password:
if not (username and password):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function log_in refactored with the following changes:

  • Simplify logical expression

request.session['good_fields'] = dict()
request.session['good_fields'] = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function create_account refactored with the following changes:

  • Replace dict() with {}

Views.py Show resolved Hide resolved
Comment on lines -108 to +112
if n == None:
if n is None:
n = len(X)

resample_i = np.floor(np.random.rand(n) * len(X)).astype(int)
X_resample = X[resample_i]
return X_resample
return X[resample_i]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function bootstrap_resample refactored with the following changes:

  • Inline variable that is only used once
  • Use x is None rather than x == None

Comment on lines -128 to +134

hours_slice, status_slice, category_slice = read_cases(filename)
print('Number of cases: {}'.format(len(hours_slice)))

# Key: category, value: list of (hours, status) points
category_map = group_by_category(hours_slice, status_slice, category_slice)
category_groups = list(get_category_groups(category_map))

Copy link
Contributor 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:

  • Replace list() with []
  • Replace dict() with {}
  • Replace list(), dict() or set() with comprehension

Comment on lines -32 to +36
if n == None:
if n is None:
n = len(X)

resample_i = np.floor(np.random.rand(n) * len(X)).astype(int)
X_resample = X[resample_i]
return X_resample
return X[resample_i]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function bootstrap_resample refactored with the following changes:

  • Inline variable that is only used once
  • Use x is None rather than x == None

data_analysis/weather.py Show resolved Hide resolved
data_analysis/weather.py Show resolved Hide resolved
@ctwardy
Copy link
Owner

ctwardy commented Oct 13, 2021

Reviewed sourcery.ai changes and all seem good. Not tested.

@ctwardy ctwardy merged commit 737bbbc into master Oct 13, 2021
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.

2 participants