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

Refactor code #53

Closed
wants to merge 3 commits into from
Closed

Conversation

VitaliyaIoffe
Copy link

@VitaliyaIoffe VitaliyaIoffe commented Dec 13, 2021

  • isort
  • flake8 refactoring
  • typehinting

@VitaliyaIoffe VitaliyaIoffe linked an issue Dec 13, 2021 that may be closed by this pull request
s3repo/model.py Outdated Show resolved Hide resolved
env_common_settings = {}
env_common_settings['credentials'] = \
json.loads(os.environ.get('RWS_CREDENTIALS'))
if (cred := os.environ.get('RWS_CREDENTIALS')) is None:
Copy link
Author

Choose a reason for hiding this comment

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

be careful: this assignment is allowed from python 3.8

Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.
given your comment, I would prefer it to stay the way it was.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think so due to in case of staying with your way I should describe type manually. It is a wrong way I guess, otherwise, the type would be assigned dynamically.

s3repo/model.py Outdated Show resolved Hide resolved
s3repo/view.py Outdated

return render_template('index.html', **list_parameters)

@staticmethod
def _get_file(path, response):
def _get_file(path, response) -> Response:
Copy link
Author

Choose a reason for hiding this comment

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

path and response are not described

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@LeonidVas LeonidVas left a comment

Choose a reason for hiding this comment

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

Hi! Thank you for the patchset.
Common comments:

  • isort: sort imports -> lint: add sorting of imports with isort
    I think this commit is pointless without adding a workflow to CI/CD. But really useful with adding to CI/CD.
  • flake8: fix style -> codestyle: fix style according flake8. The same point as in the previous one.
  • typing: add typing -> codestyle: add typing. I think it's enough to specify the types for the arguments and return values of the functions. Specify types for internal variables - overkill.

app.py Outdated Show resolved Hide resolved
app.py Show resolved Hide resolved
@@ -1,5 +1,6 @@
"""Description of the uploaded / downloaded package."""


Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.

Copy link
Author

@VitaliyaIoffe VitaliyaIoffe Feb 9, 2022

Choose a reason for hiding this comment

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

upd: have to fix

app.py Outdated Show resolved Hide resolved
env_model_settings['secret_access_key'] = os.getenv('S3_SECRET_KEY')
env_model_settings['public_read'] = get_bool_env('S3_PUBLIC_READ', False)
env_model_settings['force_sync'] = get_bool_env('RWS_FORCE_SYNC', False)
env_model_settings = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.

Copy link
Author

Choose a reason for hiding this comment

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

I don't agree, see comments above

s3repo/view.py Outdated Show resolved Hide resolved
@@ -27,42 +28,43 @@ def _readable_size(size):
return readable_size
size /= 1024.0

return "%3.1f B" % (size)
return "%3.1f B" % size
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.
What's the code style rule being violated here?

Copy link
Author

Choose a reason for hiding this comment

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

Remove redundant parentheses

'path': path,
'parent_path': parent_path,
'items': readable_items}
list_parameters = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.

s3repo/view.py Outdated

return render_template('index.html', **list_parameters)

@staticmethod
def _get_file(path, response):
def _get_file(path, response) -> Response:
Copy link
Contributor

Choose a reason for hiding this comment

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

s3repo/view.py Outdated
"""Show a directory or download a file according to the
"subpath" path.
def dispatch_request(self, subpath='/') -> Response:
"""Show a directory or download a file according to the "subpath" path.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related with the commit.
What's the code style rule being violated here?

@filonenko-mikhail
Copy link

Is such pull request still actual?

@LeonidVas
Copy link
Contributor

Is such pull request still actual?

Yep. The author planned to finish it.

@VitaliyaIoffe
Copy link
Author

VitaliyaIoffe commented Jan 31, 2022

Is such pull request still actual?

Yep. The author planned to finish it.

The author is here again!

But I am not a team member and can't push to the pr :( . What way should I use to finish? Use new pr from my repo?
@LeonidVas, please direct me in the messenger, I don't check any updates now from GitHub.

@Totktonada
Copy link
Member

I temporary give you write access to finish this PR (sorry, I can't keep this permission forever).

@VitaliyaIoffe
Copy link
Author

I temporary give you write access to finish this PR (sorry, I can't keep this permission forever).

Not a problem. Thank you!

@VitaliyaIoffe VitaliyaIoffe force-pushed the VitaliyaIoffe/37-add-typehinting branch from 07e83bc to fff4f87 Compare February 5, 2022 17:16
@VitaliyaIoffe
Copy link
Author

Just rebased. It takes more time to finish.

@VitaliyaIoffe VitaliyaIoffe force-pushed the VitaliyaIoffe/37-add-typehinting branch 2 times, most recently from a3523bd to 946e3d5 Compare February 9, 2022 22:40
@VitaliyaIoffe VitaliyaIoffe force-pushed the VitaliyaIoffe/37-add-typehinting branch 2 times, most recently from 49675fc to 56269a5 Compare February 22, 2022 20:37
@VitaliyaIoffe VitaliyaIoffe force-pushed the VitaliyaIoffe/37-add-typehinting branch from 56269a5 to 6343809 Compare February 22, 2022 20:39
@VitaliyaIoffe
Copy link
Author

@LeonidVas

@LeonidVas
Copy link
Contributor

Hi! Sorry I didn't review this patch in time. We are planning to migrate to nexus and archive this service, so no work is being done here other than bug fixes.
If company policy is changed, I will reopen PR, update and take it on board if Yaroslav doesn't mind.

@LeonidVas LeonidVas closed this Feb 13, 2023
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.

Add typehinting
4 participants