-
Notifications
You must be signed in to change notification settings - Fork 17
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
Preliminary work for JSON import/export (Sourcery refactored) #103
Conversation
46d18dc
to
aa3dac3
Compare
if not constraint in self.constraints: | ||
if constraint not in self.constraints: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function SchedulingContext.add_constraint
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
)
problem_properties = {} | ||
problem_properties["name"] = scheduling_problem.name | ||
problem_properties["horizon"] = scheduling_problem.horizon_defined_value | ||
problem_properties["delta_time"] = scheduling_problem.delta_time | ||
problem_properties["start_time"] = scheduling_problem.start_time | ||
problem_properties["end_time"] = scheduling_problem.end_time | ||
problem_properties = { | ||
'name': scheduling_problem.name, | ||
'horizon': scheduling_problem.horizon_defined_value, | ||
'delta_time': scheduling_problem.delta_time, | ||
'start_time': scheduling_problem.start_time, | ||
'end_time': scheduling_problem.end_time, | ||
} | ||
|
||
d["ProblemParameters"] = problem_properties | ||
# Tasks | ||
tasks = {} | ||
for task in scheduling_problem.context.tasks: | ||
new_task_entry = {} | ||
new_task_entry["type"] = type(task).__name__ | ||
new_task_entry["optional"] = task.optional | ||
new_task_entry = {'type': type(task).__name__, 'optional': task.optional} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function export_json_to_string
refactored with the following changes:
- Merge dictionary assignment with declaration (
merge-dict-assign
) - Simplify logical expression using De Morgan identities (
de-morgan
)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.02%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Codecov Report
@@ Coverage Diff @@
## json-import-export #103 +/- ##
===================================================
Coverage 95.48% 95.49%
===================================================
Files 38 38
Lines 4009 3993 -16
===================================================
- Hits 3828 3813 -15
+ Misses 181 180 -1
Continue to review full report at Codecov.
|
Pull Request #102 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
json-import-export
branch, then run:Help us improve this pull request!