-
Notifications
You must be signed in to change notification settings - Fork 81
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
Generic shares_base module and specific s3_datasets_shares module - part 2 (db objects to shares_base) #1294
Conversation
ec2404e
to
d78d95f
Compare
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.
some stylistic nits, feel free to disregard
def get_transition_target(self, prev_state): | ||
if self.validate_transition(prev_state): | ||
for target_state, list_prev_states in self._transitions.items(): | ||
if prev_state in list_prev_states: |
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.
nit: not in
and drop the else branch
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.
I just copy/pasted the code. I was very tempted to do changes on the implementation of the state machines, but I think we should do a review of them in a separate PR
def __init__(self, name, transitions): | ||
self._name = name | ||
self._transitions = transitions | ||
self._all_source_states = [*set([item for sublist in transitions.values() for item in sublist])] |
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.
nits
itertools.chain.from_iterable(transitions.values())
should flatten your values- why convert the set to list? I guess you want to dedup but why convert back to list?
- by converting to set you assume that the values are hashable, I can see that are enum values so they must be but give it a thought
self._name = name | ||
self._transitions = transitions | ||
self._all_source_states = [*set([item for sublist in transitions.values() for item in sublist])] | ||
self._all_target_states = [item for item in transitions.keys()] |
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.
nit: why is this needed? what's wrong with self._all_target_states = transitions.keys()
?
Feature or Bugfix
Detail
As explained in the design for #1123 and #1283 we are trying to implement generic
datasets_base
andshares_base
modules that can be used by any type of datasets and by any type of shareable object in a generic way.In this PR:
shares_base
module.Relates
Security
Please answer the questions below briefly where applicable, or write
N/A
. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
eval
or similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.